<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - 实验室辅助管理系统</title>
    <link rel="stylesheet" th:href="@{/css/fontawesome-local.css}">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
        }

        body {
            background: linear-gradient(135deg, #1a73e8, #0d47a1);
            min-height: 100vh;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #333;
        }

        .login-container {
            background: white;
            border-radius: 15px;
            box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            width: 400px;
            max-width: 90%;
        }

        .login-header {
            background: linear-gradient(135deg, #1a73e8, #0d47a1);
            color: white;
            padding: 30px;
            text-align: center;
        }

        .login-header i {
            font-size: 48px;
            margin-bottom: 15px;
        }

        .login-header h1 {
            font-size: 24px;
            margin-bottom: 10px;
        }

        .login-header p {
            opacity: 0.9;
            font-size: 14px;
        }

        .login-body {
            padding: 40px 30px;
        }

        .form-group {
            margin-bottom: 25px;
            position: relative;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #555;
        }

        .form-control {
            width: 100%;
            padding: 15px 20px;
            border: 2px solid #e1e5e9;
            border-radius: 8px;
            font-size: 16px;
            transition: all 0.3s ease;
            background-color: #f8f9fa;
        }

        .form-control:focus {
            border-color: #1a73e8;
            outline: none;
            background-color: white;
            box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
        }

        .input-icon {
            position: absolute;
            right: 15px;
            top: 50%;
            transform: translateY(-50%);
            color: #999;
        }

        .btn {
            width: 100%;
            padding: 15px;
            background: linear-gradient(135deg, #1a73e8, #0d47a1);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.3s ease;
            margin-bottom: 20px;
        }

        .btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(26, 115, 232, 0.3);
        }

        .btn:active {
            transform: translateY(0);
        }

        .test-accounts {
            background-color: #f8f9fa;
            border-radius: 8px;
            padding: 20px;
            margin-top: 20px;
        }

        .test-accounts h3 {
            color: #1a73e8;
            margin-bottom: 15px;
            font-size: 16px;
            text-align: center;
        }

        .account-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px;
            background: white;
            border-radius: 6px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: all 0.3s ease;
        }

        .account-item:hover {
            background-color: #e3f2fd;
            transform: translateX(5px);
        }

        .account-info {
            flex: 1;
        }

        .account-role {
            font-weight: 600;
            color: #1a73e8;
        }

        .account-username {
            font-size: 14px;
            color: #666;
        }

        .quick-login {
            background-color: #1a73e8;
            color: white;
            padding: 5px 10px;
            border-radius: 4px;
            font-size: 12px;
            border: none;
            cursor: pointer;
        }

        .error-message {
            background-color: #f8d7da;
            color: #721c24;
            padding: 12px;
            border-radius: 6px;
            margin-bottom: 20px;
            border: 1px solid #f5c6cb;
        }

        .success-message {
            background-color: #d4edda;
            color: #155724;
            padding: 12px;
            border-radius: 6px;
            margin-bottom: 20px;
            border: 1px solid #c3e6cb;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="login-header">
            <i class="fas fa-flask"></i>
            <h1>实验室辅助管理系统</h1>
            <p>Laboratory Management System</p>
        </div>
        
        <div class="login-body">
            <form action="/login" method="post">
                <div class="form-group">
                    <label for="username">用户名</label>
                    <input type="text" id="username" name="username" class="form-control" placeholder="请输入用户名" required>
                    <i class="fas fa-user input-icon"></i>
                </div>
                
                <div class="form-group">
                    <label for="password">密码</label>
                    <input type="password" id="password" name="password" class="form-control" placeholder="请输入密码" required>
                    <i class="fas fa-lock input-icon"></i>
                </div>
                
                <button type="submit" class="btn">
                    <i class="fas fa-sign-in-alt"></i> 登录
                </button>
            </form>
            
            <div class="test-accounts">
                <h3><i class="fas fa-info-circle"></i> 测试账号</h3>
                
                <div class="account-item" onclick="quickLogin('admin', '123456')">
                    <div class="account-info">
                        <div class="account-role">超级管理员</div>
                        <div class="account-username">用户名: admin / 密码: 123456</div>
                    </div>
                    <button type="button" class="quick-login">快速登录</button>
                </div>
                
                <div class="account-item" onclick="quickLogin('zhang_lab', '123456')">
                    <div class="account-info">
                        <div class="account-role">实验室管理员</div>
                        <div class="account-username">用户名: zhang_lab / 密码: 123456</div>
                    </div>
                    <button type="button" class="quick-login">快速登录</button>
                </div>
            </div>
        </div>
    </div>

    <script>
        function quickLogin(username, password) {
            document.getElementById('username').value = username;
            document.getElementById('password').value = password;
            document.querySelector('form').submit();
        }
        
        // 检查URL参数显示错误信息
        const urlParams = new URLSearchParams(window.location.search);
        if (urlParams.get('error')) {
            const errorDiv = document.createElement('div');
            errorDiv.className = 'error-message';
            errorDiv.innerHTML = '<i class="fas fa-exclamation-triangle"></i> 用户名或密码错误，请重试';
            document.querySelector('.login-body').insertBefore(errorDiv, document.querySelector('form'));
        }
        
        if (urlParams.get('logout')) {
            const successDiv = document.createElement('div');
            successDiv.className = 'success-message';
            successDiv.innerHTML = '<i class="fas fa-check-circle"></i> 已成功退出登录';
            document.querySelector('.login-body').insertBefore(successDiv, document.querySelector('form'));
        }
    </script>
</body>
</html> 